<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no"/>
<link rel="stylesheet" href="./css/ydui.css" type="text/css"/>
<link rel="stylesheet" href="./css/demo.css" type="text/css"/>
<link href="./css/reset.css" rel="stylesheet" type="text/css">
<link href="./css/receiving-adress.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="near-box">
	<div class="header">
		<a href="javascript:history.back()" class="left"></a>
		<p class="headerText">收货地址</p>
	</div>
	<div class="bigbox">
		 <div class="receiv-text1">地址信息</div>
         <div class="receiv-box1"><input id="uname" type="text" name="" maxlength="5" class="receiv-input1" placeholder="收货人姓名（请使用真实姓名）"></div>
         <div class="receiv-box1"><input id="uphone" type="text" name="" maxlength="11" class="receiv-input1" placeholder="手机号码"></div>
         <div class="delivery-layer-box">
    		<div class="cell-item">
                <div class="cell-right cell-arrow">
                    <input type="text" class="cell-input" readonly id="J_Address" placeholder="请选择收货地址">
                </div>
            </div>
	    </div>
         <div class="receiv-box2"><textarea id="addressDatails" class="receiv-input2" placeholder="详细地址"></textarea></div>
         <button class="set-text1" onclick="addressADD()">保存</button>
	</div>

</div>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="./js/ydui.citys.js"></script> 
<script type="text/javascript" src="./js/ydui.js"></script>
<script type="text/javascript">
	/**
 * 默认调用
 */
!function () {
	var $target = $('#J_Address');

	$target.citySelect();

	$target.on('click', function (event) {
		event.stopPropagation();
		$target.citySelect('open');
	});

	$target.on('done.ydui.cityselect', function (ret) {
		$(this).val(ret.provance + ' ' + ret.city + ' ' + ret.area);
	});
}();
</script>
<script type="text/javascript">
function addressADD(){
	var uName=$("#uname").val();
	var uPhone=$("#uphone").val();
	if(!(/^1[34578]\d{9}$/.test(uPhone))){ 
        alert("请填写11位数有效手机号");  
        return false; 
    } 
	var uAddress=$("#J_Address").val();
	var datails=$("#addressDatails").val();
	var address=uAddress+datails;
		$.post("../../../tszs/txr/addressAdd.do",{uName:uName,uPhone:uPhone,uAddress:address},function(data){
			if(data.type==1){
				window.parent.location.reload();
				window.location.href="receiving-adress-list.jsp";
			}
		},"json")
}
</script>
</body>
</html>